import { RouteRecordRaw } from 'vue-router'
import notFound from '@renderer/views/404.vue'
import loginPage from '@renderer/views/login/login.vue'

// 超级管理员页面
import AdminDashboard from '@renderer/views/admin/AdminDashboard.vue'
import ShopManagement from '@renderer/views/admin/ShopManagement.vue'
import ManagerManagement from '@renderer/views/admin/ManagerManagement.vue'
import SystemMonitoring from '@renderer/views/admin/SystemMonitoring.vue'

// 店长端布局
import ManagerLayout from '@renderer/components/layout/ManagerLayout.vue'

// 店长端页面 (懒加载)
const ManagerDashboard = () => import('@renderer/views/manager/ManagerDashboard.vue')
const ManagerOrders = () => import('@renderer/views/manager/ManagerOrders.vue')
const ManagerWorkers = () => import('@renderer/views/manager/ManagerWorkers.vue')
const ManagerCustomers = () => import('@renderer/views/manager/ManagerCustomers.vue')
const ManagerServices = () => import('@renderer/views/manager/ManagerServices.vue')
const ManagerFinance = () => import('@renderer/views/manager/ManagerFinance.vue')
const ManagerSettings = () => import('@renderer/views/manager/ManagerSettings.vue')
const ManagerLogs = () => import('@renderer/views/manager/ManagerLogs.vue')

// 打手端页面
const WorkerOrders = () => import('@renderer/views/worker/WorkerOrders.vue')

const routes: Array<RouteRecordRaw> = [
  { path: '/:pathMatch(.*)*', component: notFound },
  { path: '/', name: '登录', component: loginPage },
  { path: '/login', name: '登录页', component: loginPage },
  
  // 超级管理员路由 (需要登录后才能访问)
  { path: '/admin/dashboard', name: '超级管理员工作台', component: AdminDashboard },
  { path: '/admin/shops', name: '店铺管理', component: ShopManagement },
  { path: '/admin/managers', name: '店长管理', component: ManagerManagement },
  { path: '/admin/monitoring', name: '系统监控', component: SystemMonitoring },
  
  // 店长路由 - 使用布局容器
  {
    path: '/manager',
    component: ManagerLayout,
    children: [
      { path: '', redirect: '/manager/dashboard' },
      { path: 'dashboard', name: '店长工作台', component: ManagerDashboard },
      { path: 'orders', name: '订单管理', component: ManagerOrders },
      { path: 'workers', name: '打手管理', component: ManagerWorkers },
      { path: 'customers', name: '客户管理', component: ManagerCustomers },
      { path: 'services', name: '服务管理', component: ManagerServices },
      { path: 'finance', name: '财务管理', component: ManagerFinance },
      { path: 'settings', name: '店铺设置', component: ManagerSettings },
      { path: 'logs', name: '系统日志', component: ManagerLogs }
    ]
  },
  
  // 打手路由 (需要登录后才能访问)
  { path: '/worker/orders', name: '打手接单', component: WorkerOrders },
]

export default routes
